<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Jstorm UI</title>
</h:head>

<h:body>
	<h:outputLink value="clusters.jsf">
		<h1>
			<h:outputText value="JStorm Clusters" />
		</h1>
	</h:outputLink>
	<h2>Cluster Summary</h2>

	<h:form>
		<p:dataTable id="clustesummary" var="cls" value="#{mainpage.csumm}">


			<p:column>
				<f:facet name="header">
					<h:outputText value="Nimbus Master" />
				</f:facet>
				<h:outputText value="#{cls.nimbusHostname}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Uptime" />
				</f:facet>
				<h:outputText value="#{cls.nimbusUptime}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Supervisors" />
				</f:facet>
				<h:outputText value="#{cls.supervisorNum}" />
			</p:column>

			<p:column>
				<f:facet name="header">
				<h:outputText value="Total Ports" />
				</f:facet>
				<h:outputText value="#{cls.totalPortSlotNum}" />
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="Used Ports" />
				</f:facet>
				<h:outputText value="#{cls.usedPortSlotNum}" />
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="Free Ports" />
				</f:facet>
				<h:outputText value="#{cls.freePortSlotNum}" />
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="version" />
				</f:facet>
				<h:outputText value="#{cls.version}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Conf" />
				</f:facet>
				<h:outputLink value="conf.jsf" target="_blank">
					<h:outputText value="conf" />
					<f:param name="clusterName" value="#{param.clusterName}" />
					<f:param name="host" value="#{cls.nimbusIp}" />
					<f:param name="port" value="#{cls.nimbusLogPort}" />
				</h:outputLink>
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="Log" />
				</f:facet>
				<h:outputLink value="listlog.jsf" target="_blank">
					<h:outputText value="logs" />
					<f:param name="clusterName" value="#{param.clusterName}" />
					<f:param name="host" value="#{cls.nimbusIp}" />
					<f:param name="port" value="#{cls.nimbusLogPort}" />
				</h:outputLink>
			</p:column>

		</p:dataTable>
	</h:form>

	<h2></h2>

	<h:form>
		<p:dataTable id="slaveSumm" var="sla" value="#{mainpage.slaves}"
			sortBy="#{sla.uptime}" sortOrder="ASCENDING">
			<p:column>
				<f:facet name="header">
					<h:outputText value="Nimbus Slave" />
				</f:facet>
				<h:outputText value="#{sla.hostname}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Uptime" />
				</f:facet>
				<h:outputText value="#{sla.uptime}" />
			</p:column>
			
			<p:column>
				<f:facet name="header">
					<h:outputText value="Conf" />
				</f:facet>
				<h:outputLink value="conf.jsf" target="_blank">
					<h:outputText value="conf" />
					<f:param name="clusterName" value="#{param.clusterName}" />
					<f:param name="host" value="#{sla.ip}" />
					<f:param name="port" value="#{sla.logviewPort}" />
				</h:outputLink>
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Log" />
				</f:facet>
				<h:outputLink value="listlog.jsf" target="_blank">
					<h:outputText value="logs" />
					<f:param name="clusterName" value="#{param.clusterName}" />
					<f:param name="host" value="#{sla.ip}" />
					<f:param name="port" value="#{sla.logviewPort}" />
				</h:outputLink>
			</p:column>

		</p:dataTable>
	</h:form>

	<h2>Topology Summary</h2>
	<h:form>
		<p:dataTable id="topologysummary" var="topo" value="#{mainpage.tsumm}"
			sortBy="#{topo.uptime}" sortOrder="ASCENDING">

			<p:column>
				<f:facet name="header">
					<h:outputText value="Topology Name" />
				</f:facet>

				<h:outputLink value="topology.jsf">
					<h:outputText value="#{topo.topologyName}" />
                    <f:param name="clusterName" value="#{param.clusterName}" />
					<f:param name="topologyid" value="#{topo.topologyId}" />
				</h:outputLink>

			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Topology Id" />
				</f:facet>
				<h:outputText value="#{topo.topologyId}" />

			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Status" />
				</f:facet>
				<h:outputText value="#{topo.status}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Uptime" />
				</f:facet>
				<h:outputText value="#{topo.uptime}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Worker Num" />
				</f:facet>
				<h:outputText value="#{topo.numWorkers}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Task Num" />
				</f:facet>
				<h:outputText value="#{topo.numTasks}" />
			</p:column>

                        <p:column>
				<f:facet name="header">
					<h:outputText value="Warning" />
				</f:facet>
				<h:outputText value="#{topo.errorInfo}" />
			</p:column>

		</p:dataTable>
	</h:form>
	<h2>Supervisor Summary</h2>
	<h:form>
		<p:dataTable id="supervisorsummary" var="ssumm"
			value="#{mainpage.ssumm}" sortBy="#{ssumm.host}"
			sortOrder="ASCENDING">
			<p:column>
				<f:facet name="header">
					<h:outputText value="Host" />
				</f:facet>

				<h:outputLink value="supervisor.jsf">
					<h:outputText value="#{ssumm.host}" />
					<f:param name="clusterName" value="#{param.clusterName}" />
					<f:param name="host" value="#{ssumm.host}" />
				</h:outputLink>
			</p:column>


			<p:column>
				<f:facet name="header">
					<h:outputText value="Uptime" />
				</f:facet>
				<h:outputText value="#{ssumm.uptime}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Total Port" />
				</f:facet>
				<h:outputText value="#{ssumm.totalPort}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Used Port" />
				</f:facet>
				<h:outputText value="#{ssumm.usedPort}" />
			</p:column>

		</p:dataTable>
	</h:form>

	<h2>Zookeeper Summary</h2>

	<h:form>
		<p:dataTable id="zkSumm" var="cls" value="#{mainpage.csumm}">

			<p:column>
				<f:facet name="header">
					<h:outputText value="Zookeeper Server" />
				</f:facet>
				<p:dataTable id="zkServers" var="zkServer"
					value="#{mainpage.zkServers}" sortBy="#{zkServer}"
					sortOrder="ASCENDING">
					<p:column>
						<h:outputText value="#{zkServer}" />
					</p:column>
				</p:dataTable>
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Zookeeper Port" />
				</f:facet>
				<h:outputText value="#{mainpage.zkPort}" />
			</p:column>

		</p:dataTable>
	</h:form>
</h:body>
</html>
